import Demo from "@/views/demo"
import React from "react"
import { Navigate } from "react-router-dom"

// 路由懒加载 按需加载，用 suspense包裹 是让需要的文件下载
const Home = React.lazy(() => import("@/views/home"))
const Detail = React.lazy(() => import("@/views/detail"))
const Entire = React.lazy(() => import("@/views/entire"))

const routes = [
  {
    path: "/",
    // 路由跳转
    element: <Navigate to="/home" />,
  },
  {
    path: "/home",
    element: <Home />,
  },
  {
    path: "/detail",
    element: <Detail />,
  },
  {
    path: "/entire",
    element: <Entire />,
  },
  {
    path: "/demo",
    element: <Demo />,
  },
]

export default routes
